package com.hk.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

import com.hk.dtos.BoardDTO;
import com.hk.service.BoardService;

public class BoardDetailController extends AbstractCommandController{

	private BoardService boardService;
	
	public void setBoardService(BoardService boardService) {
		this.boardService = boardService;
	}
	

	@Override
	protected ModelAndView handle(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, BindException arg3)
			throws Exception {
		// TODO Auto-generated method stub
		ModelAndView mv=new ModelAndView();
		
		BoardDTO dto=(BoardDTO)arg2;
		dto = boardService.getBoard(dto);
		
		mv.addObject("dto", dto);		
		mv.setViewName("boardDetail.jsp");
		
		return mv;
	}

}
